package com.hziee.inm.product.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hziee.inm.product.entity.OrderDetailsEntity;
import com.hziee.inm.product.service.OrderDetailsService;
import com.hziee.common.utils.PageUtils;
import com.hziee.common.utils.R;



/**
 * 
 *
 * @author yb
 * @email yangbin@gmail.com
 * @date 2020-12-12 21:06:40
 */
@RestController
@RequestMapping("product/orderdetails")
public class OrderDetailsController {
    @Autowired
    private OrderDetailsService orderDetailsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("product:orderdetails:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderDetailsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{odId}")
    //@RequiresPermissions("product:orderdetails:info")
    public R info(@PathVariable("odId") Integer odId){
		OrderDetailsEntity orderDetails = orderDetailsService.getById(odId);

        return R.ok().put("orderDetails", orderDetails);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("product:orderdetails:save")
    public R save(@RequestBody OrderDetailsEntity orderDetails){
		orderDetailsService.save(orderDetails);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("product:orderdetails:update")
    public R update(@RequestBody OrderDetailsEntity orderDetails){
		orderDetailsService.updateById(orderDetails);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("product:orderdetails:delete")
    public R delete(@RequestBody Integer[] odIds){
		orderDetailsService.removeByIds(Arrays.asList(odIds));

        return R.ok();
    }

}
